# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=cintruder
pkgver=14.f8a3f12
pkgrel=3
groups=('blackarch' 'blackarch-cracker' 'blackarch-webapp')
pkgdesc='An automatic pentesting tool to bypass captchas.'
arch=('any')
url='https://github.com/epsylon/cintruder'
license=('GPL3')
depends=('python2' 'python2-pycurl' 'python2-lxml' 'python2-pillow6')
makedepends=('git')
source=("git+https://github.com/epsylon/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare() {
  cd $pkgname

  sed -i 's|/usr/bin/env python|/usr/bin/env python2|' $pkgname
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"
  install -dm 755 "$pkgdir/usr/share/doc/$pkgname"

  install -Dm 644 docs/LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm docs/LICENSE

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" docs/*

  rm -rf docs/

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

